<template>
  <div>
    <el-pagination
      background
      layout="prev, pager, next"
      :total="total"
      :current-page="currentPage"
      :page-size="pageSize"
      @current-change="handleCurrentChange"
    >
    </el-pagination>
  </div>
</template>
<script>
export default {
  name: 'Pagination',
  data () {
    return {
    }
  },
  props: {
    total: { type: Number, default: 0 },
    currentPage: { type: Number, default: 1 },
    pageSize: { type: Number, default: 10 }
  },
  methods: {
    // currentPage改变时会触发
    handleCurrentChange (currentPage) {
      // console.log('currentPage', currentPage)
      // 向父组件传递方法参及数
      this.$emit('handleCurrentChange', currentPage)
    }
  }
}
</script>
<style scoped>
</style>
